import { createStore, combineReducers, applyMiddleware } from "redux";
import { LocaleReducerProps } from "./index.types";
import { ThemeReducerProps } from "./index.types";
import authSlice from "./authSlicer";
import themeSlice from "./themeSlicer";
import logger from "redux-logger";
import thunk from "redux-thunk";
import localeSlicer from "./localeSlicer";
import { composeWithDevTools } from "redux-devtools-extension";

export interface ReduxStoreTypes {
  themeOptions: ThemeReducerProps;
  languageProvider: LocaleReducerProps;
}

const thunkMiddleware = thunk;

export default function configureStore() {
  return createStore(
    combineReducers({
      themeOptions: themeSlice,
      languageProvider: localeSlicer,
      authStore: authSlice,
    }),
    composeWithDevTools(applyMiddleware(logger, thunkMiddleware))
  );
}
